﻿using System.ComponentModel;

namespace FrameWork.UI.Core
{
    /// <summary>
    /// 数据模型基类
    /// </summary>
    public abstract class NbPageVm : INotifyPropertyChanged
    {
        #region ___绑定属性___
        protected bool _isWaiting;
        /// <summary>
        /// 等待图标
        /// </summary>
        public virtual bool IsWaiting
        {
            get { return _isWaiting; }
            set { _isWaiting = value; OnPropertyChanged(nameof(IsWaiting)); }
        }

        protected string _tipText;
        /// <summary>
        /// 标题
        /// </summary>
        public virtual string TipText
        {
            get { return _tipText; }
            set { _tipText = value; OnPropertyChanged(nameof(TipText)); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// 数据绑定事件
        /// </summary>
        /// <param name="propertyName"></param>
        public virtual void OnPropertyChanged(string propertyName)
        {
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        protected object _tag;
        /// <summary>
        /// 数据对象
        /// </summary>
        public virtual object Tag
        {
            get { return _tag; }
            set { _tag = value; OnPropertyChanged(nameof(Tag)); }
        }
        #endregion

        #region ___绑定事件___
        /// <summary>
        /// 虚方法
        /// </summary>
        public abstract void Init();
        #endregion
    }
}
